import 'package:gameplay_flutter/generated/json/base/json_convert_content.dart';
import 'package:gameplay_flutter/lib_basemodel/discover/file_info_entity.dart';

FileInfoEntity $FileInfoEntityFromJson(Map<String, dynamic> json) {
  final FileInfoEntity fileInfoEntity = FileInfoEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    fileInfoEntity.id = id;
  }
  final int? dynamicId = jsonConvert.convert<int>(json['dynamicId']);
  if (dynamicId != null) {
    fileInfoEntity.dynamicId = dynamicId;
  }
  final String? url = jsonConvert.convert<String>(json['url']);
  if (url != null) {
    fileInfoEntity.url = url;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    fileInfoEntity.type = type;
  }
  final int? playCount = jsonConvert.convert<int>(json['playCount']);
  if (playCount != null) {
    fileInfoEntity.playCount = playCount;
  }
  final dynamic createTime = json['createTime'];
  if (createTime != null) {
    fileInfoEntity.createTime = createTime;
  }
  final dynamic updateTime = json['updateTime'];
  if (updateTime != null) {
    fileInfoEntity.updateTime = updateTime;
  }
  final dynamic status = json['status'];
  if (status != null) {
    fileInfoEntity.status = status;
  }
  final int? width = jsonConvert.convert<int>(json['width']);
  if (width != null) {
    fileInfoEntity.width = width;
  }
  final int? height = jsonConvert.convert<int>(json['height']);
  if (height != null) {
    fileInfoEntity.height = height;
  }
  final int? duration = jsonConvert.convert<int>(json['duration']);
  if (duration != null) {
    fileInfoEntity.duration = duration;
  }
  final String? snapUrl = jsonConvert.convert<String>(json['snapUrl']);
  if (snapUrl != null) {
    fileInfoEntity.snapUrl = snapUrl;
  }
  final String? videoUrl = jsonConvert.convert<String>(json['videoUrl']);
  if (videoUrl != null) {
    fileInfoEntity.videoUrl = videoUrl;
  }
  final String? gifUrl = jsonConvert.convert<String>(json['gifUrl']);
  if (gifUrl != null) {
    fileInfoEntity.gifUrl = gifUrl;
  }
  final String? videoId = jsonConvert.convert<String>(json['videoId']);
  if (videoId != null) {
    fileInfoEntity.videoId = videoId;
  }
  final dynamic playAuth = json['playAuth'];
  if (playAuth != null) {
    fileInfoEntity.playAuth = playAuth;
  }
  final dynamic contentRiskResult = json['contentRiskResult'];
  if (contentRiskResult != null) {
    fileInfoEntity.contentRiskResult = contentRiskResult;
  }
  final dynamic riskType = json['riskType'];
  if (riskType != null) {
    fileInfoEntity.riskType = riskType;
  }
  final String? description = jsonConvert.convert<String>(json['description']);
  if (description != null) {
    fileInfoEntity.description = description;
  }
  return fileInfoEntity;
}

Map<String, dynamic> $FileInfoEntityToJson(FileInfoEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['dynamicId'] = entity.dynamicId;
  data['url'] = entity.url;
  data['type'] = entity.type;
  data['playCount'] = entity.playCount;
  data['createTime'] = entity.createTime;
  data['updateTime'] = entity.updateTime;
  data['status'] = entity.status;
  data['width'] = entity.width;
  data['height'] = entity.height;
  data['duration'] = entity.duration;
  data['snapUrl'] = entity.snapUrl;
  data['videoUrl'] = entity.videoUrl;
  data['gifUrl'] = entity.gifUrl;
  data['videoId'] = entity.videoId;
  data['playAuth'] = entity.playAuth;
  data['contentRiskResult'] = entity.contentRiskResult;
  data['riskType'] = entity.riskType;
  data['description'] = entity.description;
  return data;
}

extension FileInfoEntityExtension on FileInfoEntity {
  FileInfoEntity copyWith({
    int? id,
    int? dynamicId,
    String? url,
    int? type,
    int? playCount,
    dynamic createTime,
    dynamic updateTime,
    dynamic status,
    int? width,
    int? height,
    int? duration,
    String? snapUrl,
    String? videoUrl,
    String? gifUrl,
    String? videoId,
    dynamic playAuth,
    dynamic contentRiskResult,
    dynamic riskType,
    String? description,
  }) {
    return FileInfoEntity()
      ..id = id ?? this.id
      ..dynamicId = dynamicId ?? this.dynamicId
      ..url = url ?? this.url
      ..type = type ?? this.type
      ..playCount = playCount ?? this.playCount
      ..createTime = createTime ?? this.createTime
      ..updateTime = updateTime ?? this.updateTime
      ..status = status ?? this.status
      ..width = width ?? this.width
      ..height = height ?? this.height
      ..duration = duration ?? this.duration
      ..snapUrl = snapUrl ?? this.snapUrl
      ..videoUrl = videoUrl ?? this.videoUrl
      ..gifUrl = gifUrl ?? this.gifUrl
      ..videoId = videoId ?? this.videoId
      ..playAuth = playAuth ?? this.playAuth
      ..contentRiskResult = contentRiskResult ?? this.contentRiskResult
      ..riskType = riskType ?? this.riskType
      ..description = description ?? this.description;
  }
}